package com.lechuang.system.controller;

import com.lechuang.common.result.Result;
import com.lechuang.system.manager.RegionDictionaryManager;
import com.lechuang.system.vo.RegionVo;
import com.lechuang.system.vo.TenantDetailVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/region")
@Tag(name = "省市区")
public class RegionDictionaryController {
    @Resource
    private RegionDictionaryManager regionDictionaryManager;


    @PostMapping("/getTree")
    @Operation(summary = "获取省市区")
    public Result<List<RegionVo>> getTree(@RequestParam(required = false) Long id){
        List<RegionVo> regionVos = regionDictionaryManager.getTree(id);
        return Result.success(regionVos);
    }

}
